import request from "@/utils/request";

// 获取学科列表
export const fetchSubjectList = (params) => {
  return request.get("/subject/subject", {
    params,
  });
};

// 添加学科
export const addSubjectData = (data) => {
  return request.post("/subject/subject", data);
};

export const fetchSubjectData = (id) => {
  return request.get(`/subject/subject/${id}`);
};

// 编辑课程数据
export const editSubjectData = (data) => {
  return request.put(`/subject/subject/${data.id}`, data);
};

// 上传图片
export const imageUpload = (file, config) => {
  return request.post("/index/upload", file, {
    params: {
      mode: config.mode,
      type: config.type,
    },
  });
};

export const deleteSubjectData = (id) => {
  return request.delete(`/subject/subject/${id}`);
};
